package com.capgemini.fs.app.ekms.service.util;

import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

public class SHAPasswordEncoder implements PasswordEncoder {

    
    public String encode(String input) throws NoSuchAlgorithmException, UnsupportedEncodingException {
        MessageDigest md;

            md = MessageDigest.getInstance("SHA-1");
            md.update(input.getBytes("UTF-8"));
    
        
        byte[] raw = md.digest();
        String hash = String.valueOf(Base64Coder.encode(raw));
        
        return hash;
    }
    

}
